package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;

@Setter
@Getter
public class CourseOrder {
    private Long id;

    //录入时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date inputTime;
    //潜在客户
    private Customer customer;
    //课程名称
    private SystemDictionaryItem course;
    //课程金额
    private BigDecimal money;

    public String getJson () {
        HashMap map = new HashMap();
        map.put("id", id);
        map.put("inputTime", inputTime);
        map.put("money", money);
        if (course != null) {
            map.put("courseId", course.getId());
        }
        if (customer != null) {
            map.put("customerId", customer.getId());
        }

        return JSON.toJSONString(map);
    }

}